from org.matheclipse.core.eval import *
from org.matheclipse.core.form.output import *

template='D[%s, x]'
integrand = 'Sin[x]*Cos[x] - x*Log[x]'

engine = EvalEngine.get()
util = EvalUtilities(engine, 0)
for i in range(4):
    expression = template % integrand
    result = util.evaluate(expression)
    buffer = StringBufferWriter()
    OutputFormFactory.convert(buffer, result)
    print buffer.toString()
    integrand = result
